home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: Converting numbers to strings?
- Date: 24 Mar 1996 21:44 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <24MAR199621444998@erich.triumf.ca>
- References: <4j4agq$85h@mozo.cc.purdue.edu>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4j4agq$85h@mozo.cc.purdue.edu>, jonesbr@roger.ecn.purdue.edu (Brian R. Jones) writes...
- >I am pretty familiar with the functions that convert strings into
- >numbers, but am totally unfamiliar with the reverse process. What
- >I am looking to do is have a program save several files with the
- >same basic file root, but differentiated by a number. For example
- >I have a loop in my code that varies a variable, q, that varies in
- >increments of 100. Each time through the loop, I would like to save
- >a data file called:
- >
- > out1q100.dat
- > out1q200.dat
- > out1q300.dat
- > etc.
- >
- >It seems that if I can simply convert the floating point variable, q,
- >to a string, I could use strcat to add it to the basic filename root,
-
- I would make the variable q an int, not a float, since you apparently don't
- want a decimal part in the file name...
-
- Are you familiar with the printf() and fprintf() functions? Look at their close
- relative sprintf(). (you may also find sscanf() useful when converting from
- strings to numbers...)
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
-
-
-
-
-
-
-